package com.djq.project.mq.producer.topics;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SendTopics {
    @Autowired
    private RabbitTemplate template;

    @RequestMapping("/sendTopics")
    @Scheduled(fixedDelay = 1000, initialDelay = 500)
    public String sendQueues(String routingKey , String message) {
        String context = "Exchange==topic-->b====== " + message;
        template.convertAndSend("topicExchange", routingKey, context);
        return "success";
    }
}
